#include <bits/stdc++.h>

using namespace std;

class Solution {
public:
	int minimumCost(vector<int>& cost)
	{
		sort(begin(cost), end(cost));
		int res = 0, three = 0;
		for (int i = size(cost) - 1; i >= 0; i--)
			if (++three % 3)
				res += cost[i];

		return res;
	}

private:
};

int main()
{
	[[maybe_unused]] Solution solution;
	return 0;
}
